<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:winter="http://www.winter.org">
<body>
	<div th:fragment="persona">
		<winter:output id="DialogOutput">
			<winter:output id="DireccionModalOutput">
			   	<div id="DomicilioCrearDiV" th:if="${personas.context.domicilio}">
					<winter:dialog id="@{'DomicilioDialog'}" width="80%" height="auto" title="@{'Domicilio'}" contentClass="lista-atributos" dialogClass="activar-lista-dialog" effect="fade-and-scale">
						<winter:output id="DireccionGestionOutput">
							<div id="DireccionGestionInclude" th:include="/admin/personaDireccionDialog :: DireccionGestionFragment">
							</div>
						</winter:output>
					</winter:dialog>
				</div>
			</winter:output>
			<winter:output id="TelefonoModalOutput">
			   	<div id="TelefonoCrearDiV" th:if="${personas.context.telefono}">
					<winter:dialog id="@{'TelefonoDialog'}" width="40%" height="auto" title="@{'Telefono'}" contentClass="lista-atributos" dialogClass="activar-lista-dialog" effect="fade-and-scale">
						<winter:output id="TelefonoGestionOutput">
							<div id="TelefonoGestionInclude" th:include="/admin/personaTelefonoDialog :: TelefonoGestionFragment">
							</div>
						</winter:output>
					</winter:dialog>
				</div>
			</winter:output>
			<winter:output id="DocumentoModalOutput">
			   	<div id="DocumentoCrearDiV" th:if="${personas.context.documento}">
					<winter:dialog id="@{'DocumentoDialog'}" width="80%" height="auto" title="@{'Documento'}" contentClass="lista-atributos" dialogClass="activar-lista-dialog" effect="fade-and-scale">
						<winter:output id="DocumentoGestionOutput">
							<div id="DocumentoGestionInclude" th:include="/admin/personaDocumentoDialog :: DocumentoGestionFragment">
							</div>
						</winter:output>
					</winter:dialog>
				</div>
			</winter:output>
			<winter:output id="LegitimacionModalOutput">
			   	<div id="LegitimacionCrearDiV" th:if="${personas.context.legitimacion}">
					<winter:dialog id="@{'LegitimacionDialog'}" width="60%" height="auto" title="@{'Representante'}" contentClass="lista-atributos" dialogClass="activar-lista-dialog" effect="fade-and-scale">
						<winter:output id="LegitimacionGestionOutput">
							<div id="LegitimacionGestionInclude" th:include="/admin/personaLegitimacionDialog :: LegitimacionGestionFragment">
							</div>
						</winter:output>
					</winter:dialog>
				</div>
			</winter:output>
			<winter:output id="PoderModalOutput">
			   	<div id="PoderCrearDiV" th:if="${personas.context.poder}">
					<winter:dialog id="@{'PoderDialog'}" width="60%" height="auto" title="@{'Poder'}" contentClass="lista-atributos" dialogClass="activar-lista-dialog" effect="fade-and-scale">
						<winter:output id="PoderGestionOutput">
							<div id="PoderGestionInclude" th:include="/admin/personaPoderDialog :: PoderGestionFragment">
							</div>
						</winter:output>
					</winter:dialog>
				</div>
			</winter:output>
		</winter:output>
		<winter:output id="CrearEditarPersonaOutput">
		  <div id="NuevoPersonaContainer" th:if="${personas.context.persona}">
			<div id="BarraNuevoPersona" th:if="${personas.context.persona}">
				<div class="form-title" th:text="@{'Persona'}" th:if="${!personas.escribano}">Persona</div>
				<div class="form-title" th:text="@{'Escribano'}" th:if="${personas.escribano}">Escribano</div>
				<winter:row>
					<winter:column type="col-md-4">
						<winter:select id="selectTipoPersona" 
							field="*{persona.tipoPersona}"
							collection="per, rowPer : ${personas.tiposPer}"
							value="${per.id}" text="@{${per.descripcion}}"
							label="@{'Tipo: '}"
							required="true"
							disabled="${personas.escribano}"
							requiredmessage="#{label.persona.estadocivil.requerido}"
							modern="true" 
							showglobalmessage="true">
						</winter:select>
						<winter:event id="EventTipoPersona" event="change"
							target="selectTipoPersona"
							url="@{'/personas/tipoPersonaEvent'}" form="PersonasForm"
							update="CrearEditarPersonaOutput, PersonaInfoTabsOutput" object="personas" immediate="true"
							showstatus="true" showstatuselement="true">
						</winter:event>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:inputtext id="NuevoPersonaNombre"
							field="*{persona.nombresRazon}" 
							label="#{label.persona.nombres}" 
							required="true"
							requiredimage="/images/icons/exclamation-small-red.png"
							requiredmessage="#{label.persona.nombres.requerido}"
							maxlength="250"
							maxlengthmessage="Favor ingrese hasta 250 digitos"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text capitalize">
						</winter:inputtext>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:inputtext id="NuevoPersonaApellido" 
							field="*{persona.apellidos}"
							label="#{label.persona.apellidos}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text capitalize"
							required="${!personas.juridica}"
							requiredimage="/images/icons/exclamation-small-red.png"
							requiredmessage="#{label.persona.apellidos.requerido}"
							maxlength="250"
							maxlengthmessage="Favor ingrese hasta 250 digitos"
							disabled="${personas.juridica}">
						</winter:inputtext>
					</winter:column>
				</winter:row>
				<winter:row>
					<winter:column type="col-md-4">
						<winter:select id="selectPaisPersona" 
							field="*{persona.pais}"
							collection="pais, rowPais : ${personas.paises}" 
							value="${pais.id}"
							text="@{${pais.descripcion}}" 
							label="#{label.persona.pais}" 
							required="true"
							requiredmessage="#{label.persona.pais.requerido}" 
							modern="true">
						</winter:select>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:datetimepicker
							id="FechaNac" 
							label="${personas.juridica} ? #{label.persona.fechaconst} : #{label.persona.fechanac}"
							field="*{persona.fechaNacimientoCreacion}" 
							format="DD/MM/YYYY"
							required="true"
							requiredmessage="@{'Favor ingrese una Fecha'}">
						</winter:datetimepicker>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:inputtext id="NuevoPersonaEmail" 
							field="*{persona.email}"
							label="#{label.persona.email}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text"
							maxlength="100" 
							email="true"
							emailmessage="Favor ingrese una dirección de correo válida"
							required="false"
							requiredimage="/images/icons/exclamation-small-red.png"
							requiredmessage="#{label.persona.email.requerido}">
						</winter:inputtext>
					</winter:column>
				</winter:row>
				<winter:row>
					<winter:column type="col-md-4">
						<winter:select id="selectSexo" 
							field="*{persona.sexoDTO}"
							collection="sexo, rowSexo : ${personas.generos}"
							value="${sexo.id}" 
							text="@{${sexo.descripcion}}"
							label="#{label.persona.sexo}" 
							required="false"
							requiredmessage="#{label.persona.sexo.requerido}" 
							modern="true"
							disabled="${personas.juridica}"
							addemptyvalue="true">
						</winter:select>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:select id="selectEstadoCivil" 
							field="*{persona.estadoCivilDTO}"
							collection="est, rowEst : ${personas.estadosCiviles}"
							value="${est.id}" 
							text="@{${est.descripcion}}"
							label="#{label.persona.estadocivil}"
							disabled="${personas.juridica}"
							addemptyvalue="true"
							required="false"
							requiredmessage="#{label.persona.estadocivil.requerido}"
							modern="true" >
						</winter:select>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:inputtext id="NuevoPersonaNupcia" 
							field="*{persona.nupcia}"
							maxlength="1" 
							label="#{label.persona.nupcia}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text"
							if="${!personas.juridica}">
						</winter:inputtext>
					</winter:column>
				</winter:row>
				<winter:row>
					<winter:column type="col-md-4">
						<winter:inputtext id="EscribanoRegNro"
						    if="${personas.escribano}"
							field="*{escribanoDTO.regitronro}" 
							label="#{label.persona.nroregistro}"
							maxlength="5" 
							required="false"
							requiredimage="/images/icons/exclamation-small-red.png"
							requiredmessage="#{label.persona.nroregistro.requerido}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text">
						</winter:inputtext>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:inputtext id="NuevoPersonaProfesion"
							field="*{persona.profesionActividad}"
							label="${personas.juridica} ? #{label.persona.actividad} : #{label.persona.profesion}"
							maxlength="250" required="false"
							requiredimage="/images/icons/exclamation-small-red.png"
							requiredmessage="#{label.persona.profesion.requerido}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text"
							value="${personas.escribano} ? 'ESCRIBANO' "
							if="${!personas.escribano}">
						</winter:inputtext>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:check id="nuevoPersonaActivo" 
							field="*{persona.activo}"
							label="#{label.common.activo}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8">
						</winter:check>
					</winter:column>
				</winter:row>
			</div>
			<winter:output id="PersonaInfoTabsOutput">
				<div id="PersonaInfoTabsContainer">		
					<winter:tabs id="ControlesTabs">
						<winter:tab-item id="panelDireccion" header="Direcciones" title="Direcciones">
						  	<div id="DireccionesInclude" th:include="/admin/personaDireccion :: DireccionFragment">
							</div>
						</winter:tab-item>
						<winter:tab-item id="panelTelefono" header="Telefonos" title="Telefonos">
						  	<div id="TelefonosInclude" th:include="/admin/personaTelefono :: TelefonoFragment">
							</div>
						</winter:tab-item>
						<winter:tab-item id="panelDocumento" header="Documentos" title="Documentos">
						  	<div id="DocumentosInclude" th:include="/admin/personaDocumento :: DocumentoFragment">
							</div>
						</winter:tab-item>
						<winter:tab-item id="panelJuridica" header="Juridica" title="Personas Juridicas" if="${personas.juridica}">
							<div id="JuridicasInclude" th:include="/admin/personaJuridica :: JuridicaFragment">
							</div>
						</winter:tab-item>
						<winter:tab-item id="panelLegitimacion" header="Legitimaciones" title="Representantes" if="${personas.juridica}">
							<div id="LegitimacionesInclude" th:include="/admin/personaLegitimacion :: LegitimacionFragment">
							</div>
						</winter:tab-item>
<!-- 						<winter:tab-item id="panelPoder" header="Poderes" title="Poderes" if="${personas.juridica}"> -->
<!-- 							<div id="PoderesInclude" th:include="/admin/personaPoder :: PoderFragment"> -->
<!-- 							</div> -->
<!-- 						</winter:tab-item> -->
					</winter:tabs>		
				</div>
			</winter:output>
			<winter:row class="button-panel-right" padded="true">
				<winter:ajaxSubmit id="CrearEscribano" 
					if="${personas.escribano}"
					form="PersonasForm"
					url="@{'/personas/guardarEscribano'}"
					update="PersonasOutput, CrearEditarPersonaOutput"
					object="personas" 
					value="Guardar Escribano" 
					showstatus="true"
					class="btn btn-cyan"
					process="CrearEditarPersonaOutput">
				</winter:ajaxSubmit>
				<winter:ajaxSubmit id="CrearPersona"
					form="PersonasForm"
					if="${!personas.escribano}"
					url="@{'/personas/guardarPersona'}"
					update="PersonasOutput, CrearEditarPersonaOutput"
					object="personas" 
					value="#{label.operaciones.guardar}"
					showstatus="true"
					class="btn btn-cyan"
					process="CrearEditarPersonaOutput">
				</winter:ajaxSubmit>
				<winter:ajaxSubmit id="CrearPersonaCancelar" 
					form="PersonasForm"
					url="@{'/personas/cancelar/PERSONAS'}" 
					update="PersonasOutput"
					value="#{label.operaciones.cancelar}" 
					showstatus="true"
					class="btn btn-danger" 
					process="CrearEditarPersonaOutput"
					immediate="true">
				</winter:ajaxSubmit>
			</winter:row>
			</div>
		</winter:output>
	</div>
</body>
</html>